#ifndef __ELECTRICITY_QUANTITY_STATISTICS_H__
#define __ELECTRICITY_QUANTITY_STATISTICS_H__

#define SEC_PER_MINUTE  60      //每分钟秒数
#define MINUTE_PER_HOUR 60      //每小时分钟数
#define SEC_PER_HOUR    3600    //每小时秒数
#define HOUR_PER_DAY    24      //每日小时数
#define DAY_PER_MONTH   31      //每月天数
#define MONTH_PER_YEAR  12      //每年月数

#define DATE_QTY  7
#define MONTH_QTY 3
#define YEAR_QTY  2

#define ELEC_QUTT_AC "AC"
#define ELEC_QUTT_BAT "BAT"
#define ELEC_QUTT_DISC "DISC"
#define ELEC_QUTT_CHRG "CHRG"

typedef enum{
    IS_DISC,    //放电
    IS_CHRG,    //充电
} isChrgOrDisc_t;

typedef enum{
    BRANCH_TYPE_AC,
    BRANCH_TYPE_BAT,
} branchType_t;

typedef enum{
    ELEC_QUTT_DATA_RESTORE,
    ELEC_QUTT_DATA_HOUR,
    ELEC_QUTT_DATA_DAY,
    ELEC_QUTT_DATA_MONTH,
    ELEC_QUTT_DATA_YEAR,
} queryDataType_t;

struct elecQuttDataDB{
    int year;
    int month;
    int day;
    int hour;
    char branchType[5];
    char chargeType[5];
    float totalElecData;
    float yearElecData;
    float monthElecData;
    float dayElecData;
    float hourElecData;
};

struct elecQuttDataDB* eqsQuttDataDBGet(void);
extern void eqsQuttDataDBInit(void);
extern float eqsQuttDataDetailGet(isChrgOrDisc_t isChrgOrDisc, branchType_t branchType, queryDataType_t queryDataType, struct elecQuttDataDB* peqdata);
extern float eqsQuttDataTodayGet(isChrgOrDisc_t isChrgOrDisc, branchType_t branchType);
extern float eqsQuttDataYesterdayGet(isChrgOrDisc_t isChrgOrDisc, branchType_t branchType);
extern float eqsQuttDataMonthGet(isChrgOrDisc_t isChrgOrDisc, branchType_t branchType);
extern float eqsQuttDataYearGet(isChrgOrDisc_t isChrgOrDisc, branchType_t branchType);
extern float eqsQuttDataTotalGet(isChrgOrDisc_t isChrgOrDisc, branchType_t branchType);
extern void eqsQuttDataDisplay(void);
extern void eqsQuttDataClear(void);
extern void electricityQuantityStatisticsThread(void* pPara);

#endif